import { mapGetters, mapActions } from 'vuex';
<template>
  <div class="address_wrap"
       @click="turnAddressList">
    <div>
      <span>{{defAddress.name}}</span> <i>{{defAddress.phone}}</i>
    </div>
    <div>
      <span>默认</span>
      <em>{{defAddress.address}}</em>
      <van-icon name="arrow"></van-icon>
    </div>
  </div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'

export default {
  computed: {
    ...mapGetters("addressStore", ["defAddress"])
  },
  created () {
    this.getAddressAction();//获取默认地址
  },
  methods: {
    ...mapActions("addressStore", ["getAddressAction"]),
    turnAddressList () {
      this.$router.push({ name: "addressList" })
    }
  }
}
</script>
<style lang="less">
.address_wrap {
  height: 200px;
  width: 100%;
  border-bottom: 10px dashed red;
  background: white;
  div:nth-child(1) {
    line-height: 100px;
    display: flex;
    padding: 0 40px;
    font-size: 30px;
    box-sizing: border-box;
    i {
      margin-left: 20px;
      font-size: 30px;
    }
  }
  div:nth-child(2) {
    display: flex;
    line-height: 100px;
    padding: 0 40px;
    box-sizing: border-box;
    position: relative;
    span {
      margin-right: 30px;
      width: 80px;
      height: 40px;
      border: 1px solid red;
      text-align: center;
      line-height: 40px;
      margin-top: 30px;
    }
    .van-icon {
      position: absolute;
      right: 30px;
      top: 0;
    }
  }
}
</style>